﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Framework;

namespace NLBS.Data.Business
{
    public class CommentFacade
    {
        private Comment comm;
        public CommentFacade(Comment comm,bool addordelete)
        {
            this.comm = comm;
            UpdateWhenDeleteInsert(addordelete);
        }



        public void UpdateWhenDeleteInsert(bool addordelete)
        {
            int count=1;
            if (!addordelete)
                count = -1;
            Article art= ArticleData.GetArticleByID(comm.LogID);
            art.CommentCount+=count;
            if (comm.AuthorID > 0)
            {
                User user = UserData.GetUserByID(comm.AuthorID);
                user.CommentCount += count;
            }
            BlogInfo.Instance().CommentCount += count;
        }


    }
}
